import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '巷道编号',
    align:"center",
    sorter: true,
    dataIndex: 'roadNo'
   },
   {
    title: '巷道数',
    align:"center",
    dataIndex: 'roadNum'
   },
   {
    title: '可入容量',
    align:"center",
    dataIndex: 'roadInNum'
   },
   {
    title: '可出容量',
    align:"center",
    dataIndex: 'roadOutNum'
   },
   {
    title: '入库锁定',
    align:"center",
    dataIndex: 'roadInLock'
   },
   {
    title: '出库锁定',
    align:"center",
    dataIndex: 'roadOutLock'
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
   },
   {
    title: '创建时间',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
   },
   {
    title: '更新人',
    align:"center",
    dataIndex: 'updateBy'
   },
   {
    title: '更新时间',
    align:"center",
    sorter: true,
    dataIndex: 'updateTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "巷道编号",
      field: 'roadNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "巷道数",
      field: 'roadNum',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "可入容量",
      field: 'roadInNum',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "可出容量",
      field: 'roadOutNum',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "入库锁定",
      field: 'roadInLock',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "出库锁定",
      field: 'roadOutLock',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "创建人",
      field: 'createBy',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "创建时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "更新人",
      field: 'updateBy',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "更新时间",
      field: "updateTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '巷道编号',
    field: 'roadNo',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入巷道编号!'},
          ];
     },
  },
  {
    label: '巷道数',
    field: 'roadNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '可入容量',
    field: 'roadInNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '可出容量',
    field: 'roadOutNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '入库锁定',
    field: 'roadInLock',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '出库锁定',
    field: 'roadOutLock',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  roadNo: {title: '巷道编号',order: 0,view: 'number', type: 'number',},
  roadNum: {title: '巷道数',order: 1,view: 'number', type: 'number',},
  roadInNum: {title: '可入容量',order: 2,view: 'number', type: 'number',},
  roadOutNum: {title: '可出容量',order: 3,view: 'number', type: 'number',},
  roadInLock: {title: '入库锁定',order: 4,view: 'number', type: 'number',},
  roadOutLock: {title: '出库锁定',order: 5,view: 'number', type: 'number',},
  createBy: {title: '创建人',order: 6,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 7,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 8,view: 'text', type: 'string',},
  updateTime: {title: '更新时间',order: 9,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
